<include file="Public/header" />
<body onselectstart="return false">
<div class="main">
	<div class="content">
		<div class="head-content">
			<div class="head-title">用户列表</div>
			<div class="head-search">
				<a href="<{:U('add')}>" class="form-button color-bg-yellow" >添加</a>
			</div>
		</div>
	</div>
	<div class="content">
		<div class="head-content">
		<form action="<{:U('User/index')}>" method='get'>
			<div class="head-search">
                <input class="form-input-small" type="text" value="<{:I('get.name')}>" name='name' placeholder="姓名" />
                <input class="form-input-small" type="text" value="<{:I('get.phone')}>" name='phone' placeholder="手机号" />

			</div>
		</form>
		</div>
	</div>
	<div class="table-list">
		<table cellpadding="0" cellspacing="0">
			<thead>
				<tr>
					<th>用户名</th>
					<th>电话</th>
					<th>网点ID</th>
					<th>快递点名称</th>
					<th>负责人</th>
					<th>用户角色</th>
					<th>地址</th>
					<th>状态</th>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
			</thead>
		<foreach name='list' item='vo'>
			<tr>
				<td><{$vo['name']}></td>
				<td><{$vo['phone']}></td>
				<td><{$vo['roleid']}></td>
				<td><{$vo['express_name']}></td>
				<td><{$vo['header']}></td>
				<td><{$vo['group']['title']|default='-'}></td>
				<td><{$vo['addr']|default='-'}></td>
				<td><{$vo['status']|get_user_status}></td>
				<td><{$vo['create_time']}></td>
				<td>
					<div class="operate-list">
						<if condition="$vo['status'] == 2">
							<button onclick="forbidden(<{$vo['id']}>,1)" style="float: none" class="form-button color-bg-green">禁用</button>
							<else />
							<button onclick="forbidden(<{$vo['id']}>,2)" style="float: none" class="form-button color-bg-green">启用</button>
						</if>

						<a class="heart" title='修改' href="<{:U('edit',array('id'=>$vo['id']))}>">
							<i class="iconfont">&#xe64f;</i>
						</a>
						<a class="delete" title='删除' onclick="info(<{$vo['id']}>)" href="javascript:void(0)">
							<i class="iconfont">&#xe62b;</i>
						</a>
					</div>
				</td>
			</tr>
		</foreach>
		</table>

		<!--没有结果时显示-->
		<if condition="!$list" >
		<div class="nodata"><i class="iconfont">&#xe607;</i><span>没有查询到符合条件的记录</span></div>
		</if>

		<!--分页效果-->
		<div class="table-foot">
			<div class="foot-page">
				<ul><{$page}></ul>
			</div>
		</div>

	</div>
</div>

<!--提示框-->
<div class="pop-window pop-delete" id="info">
	<input type="hidden" name="id" id="id"   >
	<div class="pop-notice FromUpToDown">
		<div class="notice-head">
			<div class="notice-head-title">温馨提示</div>
			<div class="notice-head-delete">×</div>
		</div>
		<div class="notice-content">
			<div>
				<i class="iconfont">&#xe607;</i>
			</div>
			<div class="notice-content-word">是否要删除本条信息？</div>
		</div>
		<div class="notice-foot">
			<a href="javascript:;" onclick="del()" class="notice-btn btn-submit">确定</a>
			<a href="javascript:;" class="notice-btn btn-drop">取消</a>
		</div>
	</div>
</div>

<include file="Public/footer" />

<script>
	//弹出询问框
	function info(id){
		$("#id").val(id);
		$("#info").show();
	}

	//删除
	function del(){
		$('#info').hide();
		var id = $("#id").val();
		$.get(
				"<{:U('del')}>",
				{
					id:id
				},
				function(res){
					if(res.status == false){
						layer.msg(res.info,{time:1000});
					}else{
						layer.msg(res.info,{time:1000});
						setTimeout("location.reload()",1000);
					}
				}
		);

	}

	function forbidden(id,status){
	var index = layer.confirm('确定禁用用户？', {
			btn: ['确定','取消'] //按钮
		}, function(){
		$.post(
				"<{:U('forbidden')}>",
				{
					id:id,
					status:status
				},function(res){
					layer.msg(res.info,{time:1000});
					setTimeout("location.reload()",1000);
				}
		)
		}, function(){
			layer.close(index);
		});
	}
</script>

</body>
</html>